package com.xy.aggregation;

import com.xy.iterator.Department;
import com.xy.iterator.InfoCollegeIterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/17 20:53
 * @description
 */
public class InfoCollege implements College {
    private List<Department> infoColleges;
    private String name;

    public InfoCollege() {
        name = "信息工程学院";
        infoColleges = new ArrayList<>();
        addDepartment("信息安全专业","信息安全专业");
        addDepartment("网络安全专业","网络安全专业");
        addDepartment("服务器专业","服务器专业");
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void addDepartment(String name, String desc) {
        infoColleges.add(new Department(name, desc));
    }

    @Override
    public Iterator<Department> creteIterator() {
        return new InfoCollegeIterator(infoColleges);
    }
}
